﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using System.Management;

namespace SCCM_Client_Injector_2014
{
    class WMIRunCommand
    {
       static void Main(string[] args)
        {
            RunRemote("my_machine_name.domain.tld","NTNET","Administrator","my_pass","notepad.exe");
        }
        static void RunRemote(string host, string realm, string user, string pass, string program)
        {
            var processToRun = new[] { program };
            var connection = new ConnectionOptions();
            var Connection1 = new ConnectionOptions();
            connection.Username = realm + "\\" + user;
            connection.Password = pass;
            var wmiScope = new ManagementScope(String.Format("\\\\{0}\\root\\cimv2", host), connection);
            var wmiProcess = new ManagementClass(wmiScope, new ManagementPath("Win32_Process"), new ObjectGetOptions());
            wmiProcess.InvokeMethod("Create", processToRun);
        }
    }
    
}
